package com.iooiee;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;


/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @Author: Yanggc
 * DateTime: 2020-05-24
 */
@Aspect
public class LogAspect {
	@Pointcut("execution(* com.iooiee.CalculateImpl.*(..))")
	public void pointCut(){}

	public void methodBefor(JoinPoint joinPoint) throws Throwable{
		String methodName = joinPoint.getSignature().getName();
//		System.out.println("执行目标方法【"+methodName+"】"+"的前置通知，入参"+ Arrays.asList(joinPoint));
	}


	@After(value = "pointCut()")
	public void methodAfter(JoinPoint joinPoint) throws  Throwable{
		String methodName = joinPoint.getSignature().getName();
//		System.out.println("执行目标方法【"+methodName+"】"+"的后置通知，入参"+ Arrays.asList(joinPoint));
	}

	@AfterReturning(value = "pointCut()" ,returning = "result")
	public void methodReturning(JoinPoint joinPoint,Object result) throws  Throwable{
		String methodName = joinPoint.getSignature().getName();
//		System.out.println("执行目标方法【"+methodName+"】"+"的返回通知，入参"+ Arrays.asList(joinPoint));
	}

	@AfterThrowing(value = "pointCut()")
	public void methodAfterThrowing(JoinPoint joinPoint) throws  Throwable{
		String methodName = joinPoint.getSignature().getName();
//		System.out.println("执行目标方法【"+methodName+"】"+"的异常通知，入参"+ Arrays.asList(joinPoint));
	}
}
